package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.Blxxtype;
import com.indusfo.spc.service.BlxxtypeService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @ProjectName: IEIS2-COM
 * @Package: com.indusfo.spc.controller
 * @ClassName: BlxxtypeController
 * @Author: 熊冰
 * @Description: 不良现象类型 视图层
 * @Date: 2019/8/20 11:56
 * @Version: 1.0
 */

@Controller
@RequestMapping("/blxxtype")
public class BlxxtypeController {
    /**
     * 注入service
     */

    @Resource
    BlxxtypeService blxxtypeService;
    //新增
    @RequestMapping(value="insertBlxxtype")
    @ResponseBody
    public JSONObject insertBlxxtype(Blxxtype blxxtype){
        blxxtype.setBadphenoTypeId(null);
        JSONObject json = blxxtypeService.insertOrUpdateBlxxtype(blxxtype) ;
        return json;

    }
    //删除
    @RequestMapping(value="delBlxxtype")
    @ResponseBody
    public JSONObject delBlxxtype(Long[] ids){
        Integer   dataState = 2;
        JSONObject json = blxxtypeService.deleteBlxxtype(ids,dataState);
        return json;

    }
    //修改
    @RequestMapping(value="updateBlxxtype")
    @ResponseBody
    public JSONObject updateBlxxtype(Blxxtype blxxtype){
        JSONObject json = blxxtypeService.insertOrUpdateBlxxtype(blxxtype) ;
        return json;

    }
    //查询
    @RequestMapping(value="queryBlxxtype")
    @ResponseBody
    public JSONObject queryBlxxtype(Blxxtype blxxtype){
        JSONObject json = blxxtypeService.listBlxxtype(blxxtype);
        return json;
    }
    //停用
    @RequestMapping(value="stopBlxxtype")
    @ResponseBody
    public JSONObject stopBlxxtype(Long[] ids){
        Integer   dataState = 3;
        JSONObject json = blxxtypeService.deleteBlxxtype(ids,dataState);
        return json;

    }

    //启用
    @RequestMapping(value="startBlxxtype")
    @ResponseBody
    public JSONObject startBlxxtype(Long[] ids) {
        Integer dataState = 1;
        JSONObject json = blxxtypeService.deleteBlxxtype(ids, dataState);
        return json;
    }
        //树
    @RequestMapping(value="treeBlxxtype")
    @ResponseBody
    public JSONObject treeBlxxtype(Blxxtype blxxtype){
        JSONObject json = blxxtypeService.treeBlxxtype(blxxtype);
        return json;

    }


}
